<?php echo $this->element('user'); ?>

<div class="aTitle">
	<h2>Results</h2>
</div>
<div class="assessment">
<span id="loading" style="display: none;"><img src="/img/loading-small.gif"></span>
		<div id="asession">
		<ul >
			<?php 
			$i = 0;
			foreach ($data as $asession)
			{
			?>
				<script type="text/javascript">
					function activate<?php echo $i ?>()
					{
						document.getElementById("li_0").className = '';
						document.getElementById("li_1").className = '';
						document.getElementById("li_2").className = '';
						document.getElementById("li_3").className = '';
						document.getElementById("li_4").className = '';
						document.getElementById("li_5").className = '';
						document.getElementById("li_6").className = '';
						document.getElementById("li_7").className = '';
						document.getElementById("li_8").className = '';
						<?php echo 'document.getElementById("li_'.$i.'").className = \'tabOn\';'; ?>
					}
				</script>
			<?php
				$assessment_name = $asession['Assessment']['name'];
				if(strlen($assessment_name) > 20)
				{
					$assessment_name = substr($assessment_name, 0, 20);
					$assessment_name .= "...";
				}
				$link = $ajax->link
				(
					$assessment_name,
					array( 'controller' => 'asessions', 'action' => 'ajax_get', $asession['Asession']['id'] ),
					array( 'update' => 'edit_div', 'indicator' => 'loading')
				);
				$dateheader = '<span class="smalltext">'.$link.'<br/><br/>'.$asession['Asession']['created'].'<br/>'.$asession['Asession']['student_number'].'</span>';

				echo '<li id="li_'.$i.'" onclick="activate'.$i.'()" class="">'.$dateheader.'</li>';
				$i++;
			}

			?>
		</ul>
		</div>
		<div id="paginator">
		<?php
			echo $paginator->prev('< ') . $paginator->numbers() . $paginator->next(' >');
		?>
		</div>

<div id='edit_div' class="rTable">

</div>
</div>
</div>